<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <link rel="stylesheet" href="${ctx}/libjs/plugins/h-ui/css/H-ui.admin.css">
    <link rel="stylesheet" href="${ctx}/libjs/plugins/h-ui/style.css">
    <%--<script src="${ctx}/libjs/jquery.min.js"></script>--%>
    <%--<script src="${ctx}/libjs/bootstrap.js"></script>--%>
    <script type="text/javascript"
            src="https://webapi.amap.com/maps?v=1.3&key=e392de55be62b195115e32b97043a1bd&plugin=AMap.Autocomplete,AMap.PlaceSearch"></script>
    <script type="text/javascript" src="${ctx}/appjs/system/customerService.js"></script>
</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return '<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">系统设置</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>设置</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>客服设置</strong>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
            '</li>' +
            '</ol>';
    });

</script>

<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <div class="columns pull-left">
                        <h5 class="font-bold">客服设置</h5>
                    </div>
                    <div class="ibox-tools">
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content" style="padding-bottom: 150px">
                    <form class="form-horizontal m-t layui-form" id="frmCustomerService">
                        <input id="customerServiceId" name="customerServiceId" value="${info.customerServiceId}" type="hidden">
                        <%--<div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">添加企业微信</label>
                            <div class="col-sm-8">
                                <div id="">
                                    <c:choose>
                                        <c:when test="${info.qrcodeImg!=null && info.qrcodeImg!=''}">
                                            <div id="">
                                                <img id="qrcodeImg1" src="${uploadPath}${info.qrcodeImg}"
                                                     width="155px" height="120px">
                                                <input type="file" id="qrcodeImg" name="qrcodeImg"/>
                                            </div>
                                        </c:when>
                                        <c:otherwise>
                                            <div id="">
                                                <img id="qrcodeImg1" src="${ctx}/statics/img/upload-img.png"
                                                     style="position: relative" width="155px" height="120px">
                                                <input type="file" id="qrcodeImg" name="qrcodeImg"/>
                                            </div>
                                        </c:otherwise>
                                    </c:choose>
                                </div>
                                <span>图片尺寸建议为：<span class="text-danger">98px*75px</span></span>
                            </div>
                        </div>--%>
                        <%--<div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">会员标识图标：</label>
                            <div class="col-sm-8">
                                <div>
                                    <c:choose>
                                        <c:when test="${level.levelLogo !=null && level.levelLogo != ''}">
                                            <img id="levelLogo" src="${level.levelLogo}" width="155px" height="120px">
                                        </c:when>
                                        <c:otherwise>
                                            <img id="levelLogo" src="${ctx}/statics/img/upload-img.png" style="position: relative" width="155px" height="120px">
                                        </c:otherwise>
                                    </c:choose>
                                </div>
                                <input type="file" id="file1" name="file1"/>
                            </div>
                        </div>--%>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">添加企业微信：</label>
                            <div class="col-sm-8">
                                <div>
                                    <c:choose>
                                        <c:when test="${info.qrcodeImg!=null && info.qrcodeImg!=''}">
                                            <img id="qrcodeImg" src="${info.qrcodeImg}" width="155px" height="120px">
                                        </c:when>
                                        <c:otherwise>
                                            <img id="qrcodeImg" src="${ctx}/statics/img/upload-img.png" style="position: relative" width="155px" height="120px">
                                        </c:otherwise>
                                    </c:choose>

                                </div>
                                <input type="file" id="file1" name="file1"/>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">客服电话</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"  name="serviceIphone" value="${info.serviceIphone}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <button type="submit" class="btn btn-primary">保存</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

  /*  $("#file1").change(function () {
        var objUrl = getObjectURL(this.files[0]);//获取文件信息
        var fileSize = $(this)[0].files[0].size
        if (objUrl) {
            if (fileSize > (2 * 1024 * 1024)) {
                layer.msg('请上传小于2M的图片！');
                $(this).val("");
                return
            }
            $("#file1").attr("src", objUrl);
        }
    });*/
    $("#file1").change(function () {
        var file = this.files[0];
        var reg = RegExp(/image/);
        if (!reg.test(file.type)) {
            parent.layer.msg("支持图片上传");
            return;
        }
        var objUrl = getObjectURL(this.files[0]);//获取文件信息
        if (objUrl) {
            $("#qrcodeImg").attr("src", objUrl);
        }
    });

    function getObjectURL(file) {
        var url = null;
        if (window.createObjectURL != undefined) {
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }
        return url;
    }
    customerService.init();
</script>
</body>
</html>
